#ifndef UTILS
#define UTILS

#include <vector>
#include <string>
#include <string.h>
using namespace std;

void split_vector(std::vector<std::string>& result,const char* s, const char* delim)
{
    if (s && strlen(s))
    {
        int len = strlen(s);
        char *src = new char[len + 1];
        strcpy(src, s);
        src[len] = '\0';
        char *tokenptr = strtok(src, delim);
        while (tokenptr != NULL)
        {
            std::string tk = tokenptr;
            result.emplace_back(tk);
            tokenptr = strtok(NULL, delim);
        }
        delete[] src;
    }
}

template <typename T>
void print_vector(vector<T>& v)
{
    for (const auto &c : v) cout << c << " ";
    cout<<endl;
}


void print_unsigned_char(unsigned char* c, int len)
{
    for( int i =0; i < len;i++)
    {
        printf("%x ", c[i]);
    }
    cout<<endl;
}

int get_char_length(unsigned char * p)
{
    int tmp = 0;
    while( *p != 0)
    {
        tmp++;
        p++;
    }
    return tmp;
}

#endif 